package com.xz.knowledgeDuplication.pattern.singleton;

/**
 * 懒汉式: 首次调用时进行调用
 *
 * @author 召
 * @date 2022-02-16 21:49:34
 */
public class Singleton03 {

    // 私有构造方法
    private Singleton03() {}

    private static Singleton03 instance;

    // 初次使用时进行创建
    public static synchronized Singleton03 getInstance() {
        if(instance == null) {
            instance = new Singleton03();
        }
        return instance;
    }
}
